        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>DistanceJointDef class / box2d Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d" data-type="DistanceJointDef">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d.html">box2d</a> &rsaquo; <a href="../box2d/DistanceJointDef.html">DistanceJointDef</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>DistanceJointDef</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<pre class="source">
class DistanceJointDef extends JointDef {
 /** The local anchor point relative to body1's origin. */
 final vec2 localAnchorA;

 /** The local anchor point relative to body2's origin. */
 final vec2 localAnchorB;

 /** The equilibrium length between the anchor points. */
 num length;

 /**
  * The mass-spring-damper frequency in Hertz.
  */
 num frequencyHz;

 /**
  * The damping ratio. 0 = no damping, 1 = critical damping.
  */
 num dampingRatio;

 DistanceJointDef() :
   super(),
   localAnchorA = new vec2.zero(),
   localAnchorB = new vec2.zero(),
   length = 1.0,
   frequencyHz = 0.0,
   dampingRatio = 0.0 {
   type = JointType.DISTANCE;
 }

 /**
  * Initialize the bodies, anchors, and length using the world
  * anchors.
  * b1: First body
  * b2: Second body
  * anchor1: World anchor on first body
  * anchor2: World anchor on second body
  */
 void initialize(Body b1, Body b2, vec2 anchor1, vec2 anchor2) {
   bodyA = b1;
   bodyB = b2;
   localAnchorA.copyFrom(bodyA.getLocalPoint(anchor1));
   localAnchorB.copyFrom(bodyB.getLocalPoint(anchor2));
   length = (anchor2 - anchor1).length;
 }
}
</pre>
</div>
<h3>Extends</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../box2d/JointDef.html">JointDef</a></span>&nbsp;&gt;&nbsp;<span class="type-box"><span class="icon-class"></span><strong>DistanceJointDef</strong></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="DistanceJointDef">
<button class="show-code">Code</button>
new <strong>DistanceJointDef</strong>() <a class="anchor-link" href="#DistanceJointDef"
              title="Permalink to DistanceJointDef.DistanceJointDef">#</a></h4>
<div class="doc">
<pre class="source">
DistanceJointDef() :
 super(),
 localAnchorA = new vec2.zero(),
 localAnchorB = new vec2.zero(),
 length = 1.0,
 frequencyHz = 0.0,
 dampingRatio = 0.0 {
 type = JointType.DISTANCE;
}
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field inherited"><h4 id="bodyA">
<button class="show-code">Code</button>
<a href="../box2d/Body.html">Body</a>         <strong>bodyA</strong> <a class="anchor-link"
            href="#bodyA"
            title="Permalink to DistanceJointDef.bodyA">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
bodyA
</pre>
</div>
</div>
<div class="field inherited"><h4 id="bodyB">
<button class="show-code">Code</button>
<a href="../box2d/Body.html">Body</a>         <strong>bodyB</strong> <a class="anchor-link"
            href="#bodyB"
            title="Permalink to DistanceJointDef.bodyB">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
bodyB
</pre>
</div>
</div>
<div class="field inherited"><h4 id="collideConnected">
<button class="show-code">Code</button>
bool         <strong>collideConnected</strong> <a class="anchor-link"
            href="#collideConnected"
            title="Permalink to DistanceJointDef.collideConnected">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
collideConnected
</pre>
</div>
</div>
<div class="field"><h4 id="dampingRatio">
<button class="show-code">Code</button>
num         <strong>dampingRatio</strong> <a class="anchor-link"
            href="#dampingRatio"
            title="Permalink to DistanceJointDef.dampingRatio">#</a>
        </h4>
        <div class="doc">
<pre class="source">
dampingRatio
</pre>
</div>
</div>
<div class="field"><h4 id="frequencyHz">
<button class="show-code">Code</button>
num         <strong>frequencyHz</strong> <a class="anchor-link"
            href="#frequencyHz"
            title="Permalink to DistanceJointDef.frequencyHz">#</a>
        </h4>
        <div class="doc">
<pre class="source">
frequencyHz
</pre>
</div>
</div>
<div class="field"><h4 id="length">
<button class="show-code">Code</button>
num         <strong>length</strong> <a class="anchor-link"
            href="#length"
            title="Permalink to DistanceJointDef.length">#</a>
        </h4>
        <div class="doc">
<pre class="source">
length
</pre>
</div>
</div>
<div class="field"><h4 id="localAnchorA">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>localAnchorA</strong> <a class="anchor-link"
            href="#localAnchorA"
            title="Permalink to DistanceJointDef.localAnchorA">#</a>
        </h4>
        <div class="doc">
<pre class="source">
localAnchorA
</pre>
</div>
</div>
<div class="field"><h4 id="localAnchorB">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>localAnchorB</strong> <a class="anchor-link"
            href="#localAnchorB"
            title="Permalink to DistanceJointDef.localAnchorB">#</a>
        </h4>
        <div class="doc">
<pre class="source">
localAnchorB
</pre>
</div>
</div>
<div class="field inherited"><h4 id="type">
<button class="show-code">Code</button>
int         <strong>type</strong> <a class="anchor-link"
            href="#type"
            title="Permalink to DistanceJointDef.type">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
type
</pre>
</div>
</div>
<div class="field inherited"><h4 id="userData">
<button class="show-code">Code</button>
Object         <strong>userData</strong> <a class="anchor-link"
            href="#userData"
            title="Permalink to DistanceJointDef.userData">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
userData
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="initialize">
<button class="show-code">Code</button>
void <strong>initialize</strong>(<a href="../box2d/Body.html">Body</a> b1, <a href="../box2d/Body.html">Body</a> b2, <a href="../vector_math/vec2.html">vec2</a> anchor1, <a href="../vector_math/vec2.html">vec2</a> anchor2) <a class="anchor-link" href="#initialize"
              title="Permalink to DistanceJointDef.initialize">#</a></h4>
<div class="doc">
<p>Initialize the bodies, anchors, and length using the world
anchors.
b1: First body
b2: Second body
anchor1: World anchor on first body
anchor2: World anchor on second body</p>
<pre class="source">
void initialize(Body b1, Body b2, vec2 anchor1, vec2 anchor2) {
 bodyA = b1;
 bodyB = b2;
 localAnchorA.copyFrom(bodyA.getLocalPoint(anchor1));
 localAnchorB.copyFrom(bodyB.getLocalPoint(anchor2));
 length = (anchor2 - anchor1).length;
}
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
